import { createRouter, createWebHashHistory } from 'vue-router';
import type { RouteRecordRaw } from 'vue-router';

import Layout from '../components/layout/index.vue';
import Workflow from '../pages/workflow/index.vue';
import DaRen from '../pages/publishflow/daren.vue';

import Login from '../pages/login/index.vue';
import Setting from '../pages/setting/index.vue';

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    component: Layout,
    redirect: 'login',
    children: [
      {
        path: 'workflow',
        name: 'Workflow',
        component: Workflow
      },
      {
        path: 'daren',
        name: 'DaRen',
        component: DaRen
      },
      {
        path: 'team',
        name: 'Team',
        component: () => import('../pages/team/index.vue')
      },
      {
        path: 'team/today',
        name: 'TeamToday',
        component: () => import('../pages/team/today.vue')
      },
      {
        path: 'team/task',
        name: 'TeamTask',
        component: () => import('../pages/team/task.vue')
      }
    ]
  },
  {
    path: '/setting',
    name: 'Setting',
    component: Setting
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export { router, routes };
